<?php 
if(!isset ($_SESSION))
                    session_start ();
include_once($_SESSION['dir'].'/formatoPagina/encabezado.php') ?>
<script type="text/javascript">
function show_confirm()
{
    var r=confirm("¿Éstas seguro de que deseas eliminar el documento?\n Si lo estás presiona 'Aceptar', en otro caso presiona 'Cancel' ");
    if (r==true)
        return true;
    else
        return false;
}
</script>
	<div id="pag">
		<?php 
                
                include_once($_SESSION['dir'].'/formatoPagina/menu.php') ?>
                <?php include_once($_SESSION['dir'].'/formatoPagina/inicioContenido.php') ?>
                    <div class="post">
                            <h2 class="title"><a href="#">Descargar Documento </a></h2>
                            <br><p>
                                    <?php
                                            include_once($_SESSION['dir'].'/Documento/tamanoArchivo.php');
                                            include_once($_SESSION['dir'].'/Documento/documento.php');
                                            $doc = new documento();
                                            $arr = $doc->conseguirDocumentos(); //se va a iniciar una sesion aqui
                                            $cant = count($arr);       
                                    ?>				
                                    
                                    <br><p>

                                    <table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="80%">

                                    <tr>

                                    <td width="34%" bgcolor="#66CD00" height="21">

                                    <p style="margin-left: 10"><b><font size="2" face="Verdana" color="#FFFFFF">

                                    Nombre</font></b></td>

                                    <td width="33%" bgcolor="#66CD00" height="21">

                                    <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">

                                    Descarga</font></b></td>


                                    <td width="33%" bgcolor="#66CD00" height="21">

                                    <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">

                                    Tamano</font></b></td>

                                    <td width="33%" bgcolor="#66CD00" height="21">

                                    <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">

                                    Abrir&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</font></b></td>

                                    <td width="33%" bgcolor="#66CD00" height="21">

                                    <p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">

                                    Eliminar&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</font></b></td>

                                    </tr> 

                                    <?php
                                    for($i = 0; $i < $cant; $i= $i+1)
                                    {

                                    ?>

                                    <tr>

                                    <td width="34%" bgcolor="#FFDCA8" height="21">

                                    <p style="margin-left: 10; margin-right: 10">

                                    <font face="Verdana" size="1">

                                    <?php echo $arr[$i+1]; ?>

                                    </font>

                                    </td>

                                    <td width="33%" bgcolor="#FFDCA8" height="21">

                                    <p style="margin-left: 10"><font face="Verdana" size="1">

                                    <a href="downloadfile.php?id=<?php echo $arr[$i]; ?>">

                                    Presiona aqu&iacute

                                    </a></font>

                                    </td>

                                    <td width="33%" bgcolor="#FFDCA8" height="21">

                                    <p style="margin-left: 10">

                                    <font face="Verdana" size="1">

                                    <?php echo tamano_archivo($arr[$i+3]); ?>

                                    </font>

                                    </td>

                                    <td width="33%" bgcolor="#FFDCA8" height="21">

                                    <p style="margin-left: 10"><font face="Verdana" size="1">

                                    <a href="showfile.php?id=<?php echo $arr[$i]; ?>">

                                    Presiona aqu&iacute

                                    </a></font>

                                    </td>

                                    <td width="33%" bgcolor="#FFDCA8" height="21">

                                    <p style="margin-left: 10"><font face="Verdana" size="1">

                                    <a href="deleteFile.php?id=<?php echo $arr[$i]; ?>" onclick = "return show_confirm() ">

                                    Presiona aqu&iacute

                                    </a></font>

                                    </td>

                                    </tr>

                                    <?php
                                    $i = $i+6;
                                    }

                                    echo "</table>";                                                                                                               							
                                    ?>
                    </div>
                    <br><p>
                    Para subir un documento presiona <strong><a href="/rspinf-usb/Documento/subirDocumento.php" style="color:green">aquí</a></strong>
                    <div style="clear: both;">&nbsp;</div>
            <?php include_once($_SESSION['dir']."/formatoPagina/finContenido.php") ?>		